#ifndef _PARSER_
#define _PARSER_

//#include <ncurses.h>

#define BUF_LEN 100
#define CMD_LINE "$> "

// class to parse, store, and dispatch commands
class cmd_parser {
	//char * cmd_buf;
	char cmd_buf[BUF_LEN];
	char buffer[BUF_LEN];
	unsigned len;
	unsigned wr_index;

	private:
		void buf_realloc (); // increases buffer size
		int cmd_parse ();
		void cmd_dispatch (); // code, filename

	public:
		cmd_parser ();
		~cmd_parser ();
		int cmd_getch (WINDOW *scr); // read 1 char, put into buf. If 'Enter' dispatch
};

// these return 0 if they recognized the code and 1 if not
int dispatch_cmd_file (int code, const char* filename);
int dispatch_cmd_sing (int code, const char* arg);
int dispatch_cmd_ID (int code, const char* arg);
#endif
